#ifndef _MB_FUNCTION_CODE_H_
#define _MB_FUNCTION_CODE_H_

#include "stdint.h"

#define MB_MAX_PDU_DATA_LEN 252

typedef enum 
{
  MB_OK       = 0x00U,
  MB_ERROR    = 0x01U,
  MB_BUSY     = 0x02U,
  MB_TIMEOUT  = 0x03U
} MB_StatusTypeDef;

/**
 * @brief FUNCTIONCODE 功能码定义
*/

typedef enum __MB_FUNCTIONCODE_HandleTypeDef
{
    MB_FUN_NONE,                      
    MB_FUN_READ_COILS,                            // 1
    MB_FUN_READ_DISCRETE_INPUTS,                  // 2
    MB_FUN_READ_HOLDING_REGISTERS,                // 3
    MB_FUN_READ_INPUT_REGISTER,                   // 4
    MB_FUN_WRITE_SINGLE_COILS,                    // 5
    MB_FUN_WRITE_SINGLE_REGISTER,                 // 6
    MB_FUN_READ_EXCEPTION_STATUS,                 // 7
    MB_FUN_DIAGNOSTIC,                            // 8
    MB_FUN_9,
    MB_FUN_10,
    MB_FUN_GET_COM_EVENT_COUNT,                   // 11
    MB_FUN_GET_COM_EVENT_LOG,                     // 12
    MB_FUN_13,
    MB_FUN_14,
    MB_FUN_WRITE_MULTIPLE_COILS,                  // 15
    MB_FUN_WRITE_MULTIPLE_REGISTERS,              // 16
    MB_FUN_REPORT_SERVER_ID,                      // 17
    MB_FUN_18,
    MB_FUN_19,
    MB_FUN_20,
    MB_FUN_21,
    MB_FUN_MASK_WRITE_REGISTER,                   // 22
    MB_FUN_READ_WRITE_MULTIPLE_REGISTERS,         // 23  
    MB_FUN_READ_FIFO_QUEUE,                       // 24
    MB_FUN_MAX
}MB_FUNCTIONCODE_HandleTypeDef;

#endif

